package com.FTW.controller;

import jakarta.annotation.Resource;
import lombok.Getter;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
public class mcpClientController {

    @Resource
    @Qualifier("deepSeekClient")
    private ChatClient chatClient;

    @Resource
    @Qualifier("deepseek")
    private ChatModel chatModel;


    @GetMapping("/client")
    public Flux<String> getWeatherByMcpClient(@RequestParam(defaultValue = "北京") String city){
        System.out.println("有MCP，Client获取城市天气");
        return chatClient.prompt(city).stream().content();
    }

    @GetMapping("/model")
    public Flux<String> getWeatherByModel(@RequestParam(defaultValue = "北京") String city){
        System.out.println("无MCP，Model获取城市天气");
        return chatModel.stream(city);
    }
}
